package Demo1;

public class Test1 {
    public static void main(String[] args) {
        DoublyLinkedList doublyLinkedList = new DoublyLinkedList();
        doublyLinkedList.addFirst(4);
        doublyLinkedList.addFirst(3);
        doublyLinkedList.addFirst(2);
        doublyLinkedList.addFirst(1);
        doublyLinkedList.display();
        doublyLinkedList.addLast(5);//测试尾插
        doublyLinkedList.display();

//        测试中间插
       doublyLinkedList.addIndex(4,8);
       doublyLinkedList.display();

//       测试删除第一个关键字节点
        doublyLinkedList.remove(1);
        doublyLinkedList.display();

//        测试删除所有符合条件的关键字
        doublyLinkedList.addLast(4);
        doublyLinkedList.addLast(4);
        doublyLinkedList.addLast(4);
        doublyLinkedList.addLast(4);
        doublyLinkedList.addLast(4);
        doublyLinkedList.removeAllKey(4);
    }
}
